<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateShopDataAreaTable extends Migrator
{
    /**
     * Migrate Up.
     */
    public function up()
    {
        $table = $this->table('shop_data_area', ['comment' => '地区', 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci']);
        $table->addColumn('pid', 'integer', ['limit' =>  11, 'default' => 0, 'comment' => '上级'])
            ->addColumn('name', 'string', ['limit'  =>  60, 'comment' => '行政区名称'])
            ->addColumn('level', 'string', ['limit'  =>  60, 'null' => true, 'default' => null, 'comment' => '行政区级别'])
            ->create();
    }

    /**
     * Migrate Down.
     */
    public function down()
    {
        $table = $this->table('shop_data_area');
        $table->drop();
    }
}